import type { App } from 'vue';

/* 自定义指令组件引入 */
import myDirective from './my-directive';
import myScrollbar from './my-scrollbar';
import gradualFont from './gradual-font';
import highlight from './highlight';

/**
 * 组装所需全局自定义指令注册
 */
const directives: any = {
  'my-directive': myDirective,
  'scrollbar': myScrollbar,
  'g-font': gradualFont,
  'highlight': highlight
}

/**
 * 全局注册
 * @param app 
 */
const install = (app: App) => {
  // 循环组装自定义指令组件
  Object.keys(directives).forEach(el => {
    app.directive(el, directives[el]);
  })
}

export default install
